package com.snow.campuslink.project.constant.Enum;

import lombok.Getter;

import java.util.Arrays;

/**
 * @Describe //微服务枚举类
 * @ClassName ModuleEnum
 * @Author Gaosl
 * @Date 2021/1/28 21:51
 */
public enum ModuleEnum {

    //日志模块
    COMMON(1, "公共模块","COMMON"),
    USER_LOGIN(2,"用户登录模块","USER_LOGIN"),
    BBS_POST(3,"校园论坛模块","BBS_POST"),
    LOST_FOUND_POST(4,"二手交易模块","LOST_FOUND_POST"),
    SECOND_HAND_GOODS(5,"二手交易模块","SECOND_HAND_GOODS"),
    OTHER(100, "其他模块","OTHER");

    /**
     * 模块对应的值
     */
    @Getter
    private final int value;
    /**
     * 模块中文描述
     */
    @Getter
    private final String desc;

    /**
     * 模块名
     */
    @Getter
    private final String name;

    ModuleEnum(int value, String desc,String name) {
        this.value = value;
        this.desc = desc;
        this.name=name;
    }

    public static ModuleEnum valueOf(int value) {
        return Arrays.stream(ModuleEnum.values())
                .filter(a -> a.getValue() == value)
                .findFirst().orElse(ModuleEnum.OTHER);
    }



}
